package com.woyowodaows.weight;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.woyowodaows.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/8/4.
 */

public class PersonItemView extends RelativeLayout {

    @BindView(R.id.tv_setting_name)
    TextView textView;
    @BindView(R.id.tv_setting_version)
    TextView hint;
    @BindView(R.id.iv_setting_right)
    ImageView ivSettingRight;

    private int code;


    public PersonItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        View view = LayoutInflater.from(context).inflate(R.layout.item_setting_list, this);
        ButterKnife.bind(this, view);

    }

    public void inVisibleR() {
        ivSettingRight.setVisibility(View.INVISIBLE);
        this.setClickable(false);
    }


    public void setTextView(String str) {
        textView.setText(str);
    }

    public String getTextView() {
        return textView.getText().toString();
    }


    public void setHint(String h) {

        if (h!=null &&!TextUtils.isEmpty(h)){
            hint.setText(h);
        }else {
            hint.setText("未设置");
        }

    }

    public String getHint() {
        return hint.getText().toString();
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setOnclickListener(OnClickListener onclickListener) {
        this.setOnClickListener(onclickListener);
    }


    public void setGoneRightImage(){
        ivSettingRight.setVisibility(View.INVISIBLE);
    }
}
